﻿<?php
/**
 * 读取配置信息
 * Enter description here ...
 * @param unknown_type $cStr
 */
function C($cStr)
{
	if (is_array($cStr)) $cStr=$cStr['cStr'];
	include("CleverPHP/Conf/config.php");	
	$rows=$CleverConfig;	
    if (file_exists(AppDir."/Conf/config.php")){
			include( AppDir."/Conf/config.php");
			if (isset($config) && isset($CleverConfig)){
			   $rows=array_merge($CleverConfig,$config);		
			}	
	}		
	return $rows[$cStr];
}

/**
 * 快捷实例化模型
 * Enter description here ...
 * @param unknown_type $ModelName
 */
function MOD($ModelName){
	$ModelName=ucfirst($ModelName);
	$ModelName=$ModelName."Model";
	return new $ModelName();
	
}
/**
 * 快捷缓存
 * Enter description here ...
 * @param unknown_type $key 缓存key
 * @param unknown_type $data 可选，缓存数据
 * @param unknown_type $isDel 可选，为true时将删除数据
 */
function S($key,$data=NULL,$isDel=FALSE){
	$Cache=new Cache();
	if ($isDel==true){
		return $Cache->delMemcache($key);		
	}
	if ($data==null){
		return $Cache->getMemcache($key);
	}else {
		return $Cache->setMemcache($data,$key);
	}
}
/**
 * 快速获取语言包文件
 * Enter description here ...
 * @param unknown_type $str
 */
function L($cStr,$lang=null){
	if ($lang==null) $lang=getBrowserLang();
	include("CleverPHP/Lang/".C("Lang").".php");	
	$rows=$CleverLang;	
    if (file_exists(AppDir."/Lang/{$lang}.php")){
			include( AppDir."/Lang/{$lang}.php");
			if (isset($Lang) && isset($CleverLang)){
			   $rows=array_merge($CleverLang,$Lang);		
			}	
	}		
	if (array_key_exists($cStr, $rows))
	{
		return $rows[$cStr];
	
	}else {
		return "找不到字段";
	}
}
?>